# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=py3-future
_pkgname=future
pkgver=0.18.3
pkgrel=4
pkgdesc="Easy, clean, reliable Python 2/3 compatibility"
url="https://python-future.org/"
arch="noarch"
license="MIT"
depends="python3"
# It can be built without it but it misses a lot of functionality
makedepends="py3-gpep517 py3-setuptools py3-wheel"
checkdepends="py3-pytest"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://pypi.io/packages/source/f/future/future-$pkgver.tar.gz
	python-3.9-support.patch
	python-3.12.patch
	"
builddir="$srcdir/$_pkgname-$pkgver"

replaces="py-future" # Backwards compatibility
provides="py-future=$pkgver-r$pkgrel" # Backwards compatibility

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
6de56a5aa5c5dd56a0dc5a6732c753530f9868036bd97e9d355f9ee6e1305e266a60c167de779cba93f09b5b3fae615193074caba2afe857ca7ea944532ef910  py3-future-0.18.3.tar.gz
9023400decb26f9ba466e2690a6f87d2738811bea4927638826bee96abef2b83faf462430948ec2b3a15aaabe22a4b29f86ae2244633f78ca3766ee7592979a7  python-3.9-support.patch
48102e39e886843bc25ce8e9a791cc28db073bce6105845548305b50f730d86be1b403061b78857816c87cd9cbe6d90c38349931e2fff7c1aba3104cde2c7f56  python-3.12.patch
"
